package gbif.common.dal;

import java.io.Serializable;
import java.util.List;

/**
 * Data access interface for domain model
 * @param <T> is the type (Class) for the entity object to be managed by the interface implementation
 * @param <K> is the type (Class or primitive type) of the field that encapsulates the primary of the entity object
 * @author Federico Mendez - GBIF
 */
public interface IBaseDAO<T,K extends Serializable> {
	public Class<T> getType();
	public void setType(Class<T> type);
	public void save(T transientInstance);
	public void delete(T persistentInstance);
	public T findById(K id);
	public List<T> findByExample(T instance);
	public List<T> findByProperty(String propertyName, Object value);
	public int bulkUpdateByProperty(String propertyName, Object value, Operation operation);
	public int bulkUpdateByProperties(String propertiesNames[], Object values[], Operation operation);
	public List<T> findAll();
	public T merge(T detachedInstance);
	public void update(T detachedInstance);
	public void attachDirty(T instance);
	public void attachClean(T instance);
}